package com.hiyee.api.controller.goods;

import com.hiyee.annotation.CurrentCustomer;
import com.hiyee.annotation.JwtVerify;
import com.hiyee.api.config.MicroServiceNameConfig;
import com.hiyee.pojo.auth.LoginCustomer;
import com.hiyee.pojo.bo.GoodsSearchBO;
import com.hiyee.response.ResponseJsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 商品信息控制器接口
 *
 * @author WangBin
 */
@FeignClient(value = MicroServiceNameConfig.MALL_SERVICE_GOODS, path = "/rest/api/goods")
public interface GoodsControllerApi {
    /**
     * 前端搜索商品列表
     *
     * @return ResponseJsonResult
     */
    @GetMapping("/search")
    @JwtVerify
    public ResponseJsonResult search(@RequestParam(required = true,value = "sort_by") String sortBy,
                                     @RequestParam(required = true, value = "sort_type") String sortType,
                                     @RequestParam(required = false, value = "category_id", defaultValue = "0") Integer categoryId,
                                     @RequestParam(required = false, value = "name", defaultValue = "") String name,
                                     @RequestParam(required = false, value = "page", defaultValue = "1") Integer page,
                                     @RequestParam(required = false, value = "page_size", defaultValue = "20") Integer pageSize,
                                     @CurrentCustomer LoginCustomer loginCustomer);

    /**
     * 前端查询商品详情
     *
     * @param Long id
     * @return ResponseJsonResult
     */
    @GetMapping("/get")
    @JwtVerify
    public ResponseJsonResult getInfo(@RequestParam(required = true, value = "goods_id") Long id);

    /**
     * 前端查询商品服务列表
     *
     * @param Long goodsId
     * @return ResponseJsonResult
     */
    @GetMapping("/service/list")
    @JwtVerify
    public ResponseJsonResult getServiceList(@RequestParam(required = true, value = "goods_id") Long goodsId);

    /**
     * 前端查询商品评价列表
     *
     * @param Integer page
     * @param Integer pageSize
     * @return ResponseJsonResult
     */
    @GetMapping("/comment/list")
    @JwtVerify
    public ResponseJsonResult getCommentList(
            @RequestParam(required = true, value = "goods_id")Long goodsId,
            @RequestParam(required = false, value = "page", defaultValue = "1")Integer page,
            @RequestParam(required = false, value = "page_size", defaultValue = "20")Integer pageSize
    );

    /**
     * 获取多规格商品信息
     *
     * @param Long productId
     * @return ResponseJsonResult
     */
    @GetMapping("/getProduct")
    @JwtVerify
    public ResponseJsonResult getProductInfo(@RequestParam(required = true, value = "product_id")Long productId);
}
